package top.lyc829.iot_android.adapter;

import android.view.View;

import androidx.appcompat.widget.AppCompatImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xuexiang.xpage.model.PageInfo;

import org.jetbrains.annotations.NotNull;

import top.lyc829.iot_android.R;

/**
 * @Author lyc
 * @create 2021-06-19 18:58
 */
public class ProfilePageAdapter extends BaseQuickAdapter<PageInfo, BaseViewHolder> {

    public ProfilePageAdapter() {
        super(R.layout.layout_widget_item);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, PageInfo pageInfo) {
        baseViewHolder.setText(R.id.item_name, pageInfo.getName());
        if (pageInfo.getExtra() != 0) {
            AppCompatImageView icon = baseViewHolder.getView(R.id.item_icon);
            Glide.with(icon)
                    .load(pageInfo.getExtra())
                    .into(icon);
        }
    }
}
